/**
 * Copyright 2013 ABSir's Studio
 * 
 * All right reserved
 *
 * Create on 2013-6-21 下午4:24:12
 */
package com.absir.android.view;

import com.absir.android.view.annotation.InjectLayer;
import com.absir.android.view.annotation.InjectView;
import com.absir.core.kernel.KernelString;

/**
 * @author absir
 * 
 */
public class InjectViewLayer extends InjectViewAbstract {

	/** injectId */
	private int injectId;

	/**
	 * @param injectLayer
	 */
	public InjectViewLayer(InjectLayer injectLayer) {
		this.injectId = injectLayer.value();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.absir.android.view.InjectViewAbstract#injectExcutor(com.absir.android
	 * .view.InjectExcutorObject)
	 */
	@Override
	public void injectExcutor(InjectExcutorObject<Object> injectExcutorObject) {
		// TODO Auto-generated method stub
		if (injectId == InjectView.ID_NONE) {
			injectId = InjectViewUtils.getResouceId(injectId, "layout", KernelString.camelInvertUnderline(injectExcutorObject.getObject().getClass().getSimpleName()));
		}

		if (injectId > 0) {
			injectExcutorObject.getInjectExcutor().setLayer(injectExcutorObject.getObject(), injectId);
		}
	}
}
